package com.zhang.authoritycenter.controller.oauth;

import com.zhang.authoritycenter.common.model.dao.auth.UserBaseDO;
import com.zhang.authoritycenter.common.model.dto.auth.AddFriendReqDTO;
import com.zhang.authoritycenter.manager.IFriendRelationManager;
import com.zhang.infrastructure.model.KingHoodResponseVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2024-03-18 16:00
 **/
@RequestMapping("/friendRelation")
@RequiredArgsConstructor
@RestController
public class FriendRelationController {

    private final IFriendRelationManager friendRelationManager;

    /**
     * 添加好友
     *
     * @param in 新好友信息
     * @return 添加好友
     * @author zfj
     * @date 2024/3/18
     */
    @PostMapping("/addFriend")
    public KingHoodResponseVO<Boolean> addFriend(@RequestBody AddFriendReqDTO in) {
        return KingHoodResponseVO.success(friendRelationManager.addFriend(in));
    }

    /**
     * 获取好友列表
     *
     * @return 好友列表
     * @author zfj
     * @date 2024/3/18
     */
    @GetMapping("/getMyFriendList")
    public KingHoodResponseVO<List<UserBaseDO>> getMyFriendList() {
        return KingHoodResponseVO.success(friendRelationManager.getMyFriendList());
    }
}
